import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/price',
    name: 'price',
    component: () => import('../views/Price.vue'),
  },
  {
    path: '/a',
    name: 'a',
    component: () => import('../testing/a.vue'),
  },
  {
    path: '/goingoil',
    name: 'goingoil',
    component: () => import('../views/GoingOil.vue'),
  },
  {
    path: '/',
    redirect:'/homeview/index', 
  },
  {
    path: '/homeview',
    name: 'homeview',
    component: () => import('../views/HomeView.vue'),
    meta:{
      keepAlive:true
    },
    children:[
      {
        path: 'index',
        name: 'index',
        component: Index,
      },
      {
        path: 'price',
        name: 'price',
        component: () => import('../views/Price.vue'),
      },
      {
        path: 'trend',
        name: 'trend',
        component: () => import('../views/Trend.vue'),
      },
      {
        path: 'oilnew',
        name: 'oilnew',
        component: () => import('../views/OilNew.vue'),
      },
      {
        path: 'me',
        name: 'me',
        component: () => import('../views/Me.vue'),
      },
  ]
   
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
